package com.quectel.core.module.forum.entity.mongo;

import com.quectel.core.constants.MongoCollectionConstants;
import com.quectel.util.client.mongo.MongoBaseModel;
import lombok.Data;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;

/**
 * @author bob
 * @email bob.yu@quectel.com
 * @date 2023/05/10 11:21
 */
@Data
@Document(MongoCollectionConstants.FORUM_TOPIC_COUNT)
@CompoundIndex(name = "idx_id_top", def = "{'_id': -1,'postCount': -1}", background = true)
public class ForumTopicCountModel implements MongoBaseModel {

    /**
     * id
     */
    @MongoId
    private Long id;

    /**
     * 话题Id
     */
    @Indexed(name = "idx_topic", unique = true, background = true)
    private Long topicId;

    /**
     * 发帖数量
     */
    private Integer postCount = 0;

    /**
     * 评论数量
     */
    private Integer commentCount = 0;

    /**
     * 点赞数量
     */
    private Integer likeCount = 0;

    /**
     * 分享数量
     */
    private Integer shareCount = 0;
}
